/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * ColapsablePlus.java
 *
 * Created on 20-nov-2011, 14:13:20
 */
package Comun;

import java.awt.Color;
import java.awt.event.KeyEvent;


/**
 *
 * @author luisramirezmartinez
 */
public final class ColapsablePlus extends PanelRoundTranslucido{
    private PanelRoundTranslucido editor=null;
    private PanelRoundTranslucido tabla=null;
    private PanelRoundTranslucido mov=null;
    private PanelRoundTranslucido cambios=null;
    private SamiFrame padre =null;
    private int tam=0;
    /** Creates new form ColapsablePlus */
    public ColapsablePlus() {
        
        initComponents();
        /*this.samiButton1.setDisplayedMnemonic('E');
        this.samiButton2.setDisplayedMnemonic('T');
        this.samiButton3.setDisplayedMnemonic('B');
        this.samiButton4.setDisplayedMnemonic('P');
        
        if(this.getEditor()==null) this.samiButton1.setEnabled(false);
        if(this.getTabla()==null) this.samiButton2.setEnabled(false);
        if(this.getMov()==null) this.samiButton3.setEnabled(false);
        if(this.getCambios()==null) this.samiButton4.setEnabled(false);
         */
       
    }
    

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        samiButton1 = new Comun.SamiButton();
        samiButton2 = new Comun.SamiButton();
        samiButton3 = new Comun.SamiButton();
        samiButton4 = new Comun.SamiButton();

        samiButton1.setDisplayedMnemonic('E');
        samiButton1.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        samiButton1.setText("Editor");
        samiButton1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                samiButton1MouseClicked(evt);
            }
        });

        samiButton2.setDisplayedMnemonic('T');
        samiButton2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        samiButton2.setText("Tabla");
        samiButton2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                samiButton2MouseClicked(evt);
            }
        });

        samiButton3.setDisplayedMnemonic('B');
        samiButton3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        samiButton3.setText("Barra de Desplazamiento");
        samiButton3.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                samiButton3MouseClicked(evt);
            }
        });

        samiButton4.setDisplayedMnemonic('P');
        samiButton4.setText("Panel de Cambios");
        samiButton4.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                samiButton4MouseClicked(evt);
            }
        });

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(samiButton1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 57, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .add(41, 41, 41)
                .add(samiButton2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 42, Short.MAX_VALUE)
                .add(37, 37, 37)
                .add(samiButton3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 162, Short.MAX_VALUE)
                .add(35, 35, 35)
                .add(samiButton4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 129, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(12, 12, 12)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(samiButton1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(samiButton4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(samiButton3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(samiButton2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void samiButton3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_samiButton3MouseClicked
        this.mov.setVisible(!this.mov.isVisible());
        if(this.mov.isVisible())
            this.samiButton3.setPrimario(Color.WHITE);
        else
            this.samiButton3.setPrimario(Color.GRAY);
        this.getPadre().pack();
    }//GEN-LAST:event_samiButton3MouseClicked

    private void samiButton1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_samiButton1MouseClicked
        this.editor.setVisible(!this.editor.isVisible());
        if(this.editor.isVisible())
            this.samiButton1.setPrimario(Color.WHITE);
           
        else
            this.samiButton1.setPrimario(Color.GRAY);
        
        this.getPadre().pack();
    }//GEN-LAST:event_samiButton1MouseClicked

    private void samiButton2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_samiButton2MouseClicked
            this.tabla.setVisible(!this.tabla.isVisible());
        if(this.tabla.isVisible())
            this.samiButton2.setPrimario(Color.WHITE);
        else
            this.samiButton2.setPrimario(Color.GRAY);
        this.getPadre().pack();
    }//GEN-LAST:event_samiButton2MouseClicked

    private void samiButton4MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_samiButton4MouseClicked
        this.cambios.setVisible(!this.cambios.isVisible());
        this.getPadre().pack();
        if(this.cambios.isVisible())
            this.samiButton4.setPrimario(Color.WHITE);
        else
            this.samiButton4.setPrimario(Color.GRAY);
    }//GEN-LAST:event_samiButton4MouseClicked

    public void accion (int valor){
        switch (valor){
                case 1:
                    this.samiButton1MouseClicked(null);
                    break;
                case 2:
                    this.samiButton2MouseClicked(null);
                    break;
                case 3:
                    this.samiButton3MouseClicked(null);
                    break;
                case 4:
                    this.samiButton4MouseClicked(null);
                    break;
                    
                default:
                    System.out.println("valor no valido");
                    
        }
    
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private Comun.SamiButton samiButton1;
    private Comun.SamiButton samiButton2;
    private Comun.SamiButton samiButton3;
    private Comun.SamiButton samiButton4;
    // End of variables declaration//GEN-END:variables

    /**
     * @return the editor
     */
    public PanelRoundTranslucido getEditor() {
        return editor;
    }

    /**
     * @param editor the editor to set
     */
    public void setEditor(PanelRoundTranslucido editor) {
        this.editor = editor;
    }

    /**
     * @return the tabla
     */
    public PanelRoundTranslucido getTabla() {
        return tabla;
    }

    /**
     * @param tabla the tabla to set
     */
    public void setTabla(PanelRoundTranslucido tabla) {
        this.tabla = tabla;
    }

    /**
     * @return the mov
     */
    public PanelRoundTranslucido getMov() {
        return mov;
    }

    /**
     * @param mov the mov to set
     */
    public void setMov(PanelRoundTranslucido mov) {
        this.mov = mov;
    }

    /**
     * @return the cambios
     */
    public PanelRoundTranslucido getCambios() {
        return cambios;
    }

    /**
     * @param cambios the cambios to set
     */
    public void setCambios(PanelRoundTranslucido cambios) {
        this.cambios = cambios;
    }

    /**
     * @return the padre
     */
    public SamiFrame getPadre() {
        return padre;
    }

    /**
     * @param padre the padre to set
     */
    public void setPadre(SamiFrame padre) {
        this.padre = padre;
    }
}
